import request from '@/utils/request'

// **************商品分类**********************

export function productClassList (data) { //商品分类列表
  return request({
    url: '/goods/goods/category/page',
    method: 'post',
    data
  })
}

export function allProudctClass () {//所有分类
  return request({
    url: '/goods/goods/category/list',
    method: 'get',
  })
}
export function setProudctBrand (data) {//设置分类品牌
  return request({
    url: '/goods/goods/ccb',
    method: 'post',
    data
  })
}
export function getClassBrand (categoryId) {//获取分类下的品牌
  return request({
    url: '/goods/goods/ccb' ,
    method: 'get',
    params : {categoryId}
  })
}
export function addProudctClass (data,method) {//添加分类
  return request({
    url: '/goods/goods/category',
    method: method,
    data
  })
}
export function delProudctClass (id) {//删除分类
  return request({
    url: '/goods/goods/category/' + id,
    method: 'DELETE',
  })
}

// **************商品管理**********************

export function productList (data) { //商品列表
  return request({
    url: '/goods/goods/page',
    method: 'post',
    data
  })
}

export function productOut (productId) { //商品下架
  return request({
    url: '/goods/goods/downline/' + productId,
    method: 'put',
  })
}
export function productPutaway (productId) { //商品上架
  return request({
    url: '/goods/goods/online/' + productId,
    method: 'put',
  })
}
export function delProduct (productIds) { //删除商品
  return request({
    url: '/goods/goods/' + productIds,
    method: 'DELETE',
  })
}
export function addProduct (data,method) { //添加编辑商品
  return request({
    url: '/goods/goods',
    method: method,
    data
  })
}
export function addProductQa (data,method) {//添加商品问答
  return request({
    url: '/evaluation/pc',
    method: method,
    data
  })
}
export function getProuductQa (productId) {//获取商品下问题
  return request({
    url: '/evaluation/pc/pcs/' + productId ,
    method: 'get',
  })
}
export function delProuductQa (data) {//商品估价问答-批量删除
  return request({
    url: '/evaluation/pc/del',
    method: 'DELETE',
    data
  })
}
export function getQaOption (conditionId,productId) {//商品估价问答-根据问答条件ID查询商品估价选项列表
  return request({
    url: '/evaluation/pco/pcos/' + conditionId + '?productId=' + productId,
    method: 'get',
  })
}
// export function addProduct () { //据问答条件ID查询商品估价选项列表
//   return request({
//     url: '/evaluation/pco/pcos/',
//     method: method,
//     data
//   })
// }


// **************品牌管理**********************

export function brandList (data) { //品牌列表
  return request({
    url: '/goods/goods/brand/page',
    method: 'post',
    data
  })
}
export function ClassBrandList (categoryId) { //根据分类id列出所有品牌
  return request({
    url: '/goods/goods/brand/' + categoryId,
    method: 'get',
  })
}
export function addBrand (data,method) { //添加品牌
  return request({
    url: '/goods/goods/brand',
    method: method,
    data
  })
}
export function delBrand (id) {//删除品牌
  return request({
    url: '/goods/goods/brand/' + id,
    method: 'DELETE',
  })
}


// **************本机检测**********************
export function localList (data) { //检测列表
  return request({
    url: '/evaluation/pidt/tpl/all',
    method: 'get',
  })
}
export function systemTypeList (type) { //根据类型查询模板 ANDROID APPLE
  return request({
    url: '/evaluation/pidt/tpl/type/' + type,
    method: 'get',
  })
}
export function addLocal(data,method) { //添加本机模板
  return request({
    url: '/evaluation/pidt',
    method: method,
    data
  })
}
export function delLocal(id) { //删除本机模板
  return request({
    url: '/evaluation/pidt/' + id,
    method: 'DELETE',
  })
}
export function getDetails (cpidtTplId) { //根据模板id获取数据
  return request({
    url: '/evaluation/pidt/' + cpidtTplId,
    method: 'get',
  })
}
export function addLocalProduct (data,method) { //跟商品添加本机检测
  return request({
    url: '/evaluation/pids',
    method: method,
    data
  })
}
export function prouductLocalList (productId) { //根据商品id获取该商品的的本机检测
  return request({
    url: '/evaluation/pids/pidss/' + productId,
    method: 'get',
  })
}
export function delProuductLocal (optionIds) { //删除本机检测
  return request({
    url: '/evaluation/pids/' + optionIds,
    method: 'DELETE',
  })
}

// **************注意事项**********************
export function noticeList (productId) { //注意事项列表
  return request({
    url: '/evaluation/careful/carefuls/' + productId,
    method: 'get',
  })
}
export function addnotice (data,method) { //添加编辑注意事项
  return request({
    url: '/evaluation/careful',
    method: method,
    data
  })
}
export function delnotice (carefulIds) { //删除注意事项
  return request({
    url: '/evaluation/careful/' + carefulIds,
    method: 'DELETE',
  })
}

// **************发货信息**********************

export function takeInfoList (productId) { //发货信息列表
  return request({
    url: '/evaluation/ri/product/' + productId,
    method: 'get',
  })
}
export function addTakeInfo (data,method) { //添加编辑发货信息
  return request({
    url: '/evaluation/ri',
    method: method,
    data
  })
}


// **************行情数据**********************

export function addMarketData (data,method) { //添加编辑行情数据
  return request({
    url: '/evaluation/pq',
    method: method,
    data
  })
}

export function delMarketData (quotationIds) { //删除行情数据
  return request({
    url: '/evaluation/pq/' + quotationIds,
    method: 'DELETE',
  })
}
export function getMarketDataList (productId) { //行情数据列表
  return request({
    url: '/evaluation/pq/pqs/' + productId,
    method: 'get',
  })
}







// **************商品条件模板**********************

export function productConditionList (data) { //条件模板列表
  return request({
    url: '/evaluation/pct/tpl/all',
    method: 'get',
  })
}
export function AddproductCondition (data,method) { //添加商品估价条件
  return request({
    url: '/evaluation/pct',
    method: method,
    data
  })
}
export function compileProductCondition (data) { //编辑商品估价条件
  return request({
    url: '/evaluation/pct',
    method: 'put',
    data
  })
}
export function Addpcot (data,method) { //添加商品估价选项
  return request({
    url: '/evaluation/pcot',
    method: method,
    data
  })
}
export function getPcot (id) { //根据条件id获取单个条件对应的选项
  return request({
    url: '/evaluation/pcot/'+ id,
    method: 'get',
  })
}
export function getAllPcot (id) { //根据条件id获取全部条件对应的选项
  return request({
    url: '/evaluation/pcot/pcots/'+ id,
    method: 'get',
  })
}
export function delPcot (id) { //根据条件id获取全部条件对应的选项删除
  return request({
    url: '/evaluation/pcot/'+ id,
    method: 'DELETE',
  })
}
export function delCondition (id) { //根据条件id删除条件模板
  return request({
    url: '/evaluation/pct/'+ id,
    method: 'DELETE',
  })
}
export function getAllTemplate (categoryId) { //获取全部商品估价(问题)条件_模板
  return request({
    url: '/evaluation/pct/tpl/all',
    method: 'get',
    params : {categoryId}
  })
}

// **************图片估计**********************

export function addImgCondition (data,method) { //添加更新图片条件
  return request({
    url: '/evaluation/pes',
    method: method,
    data
  })
}

export function addImgOption (data,method) { //添加更新图片选项
  return request({
    url: '/evaluation/peo',
    method: method,
    data
  })
}

export function delImgCondition (cpesIds) { //删除图片条件
  return request({
    url: '/evaluation/pes/' + cpesIds,
    method: 'DELETE',
  })
}

export function delImgOption (cpeoIds) { //删除图片条件
  return request({
    url: '/evaluation/peo/' + cpeoIds,
    method: 'DELETE',
  })
}

export function imgConditionList (productId) { //根据商品id查询条件列表
  return request({
    url: '/evaluation/pes/pess/' + productId,
    method: 'get',
  })
}

export function imgOptionList (cpesId) { //根据图片条件id查询选项列表
  return request({
    url: '/evaluation/peo/peos/' + cpesId,
    method: 'get',
  })
}

// **************门店管理**********************
export function shopList (data) { //门店列表
  return request({
    url: '/store/store/page',
    method: 'post',
    data
  })
}
export function addShop (data) { //添加门店地址
  return request({
    url: '/store/store',
    method: 'post',
    data
  })
}
export function compileShop (data) { //更新店铺
  return request({
    url: '/store/store',
    method: 'put',
    data
  })
}
export function delShop (id) { //删除店铺
  return request({
    url: '/store/store/' + id,
    method: 'DELETE',
  })
}
export function findShop (id) { //根据id查找店铺
  return request({
    url: '/store/store/' + id,
    method: 'get',
  })
}

export function getReginal (data) { //获取中国行政区域地址库
  JSON.stringify(data)
  return request({
    url: '/communal/reginal',
    method: 'get',
    params:data
  })
}
export function getInfo (id) { //根据id查找店铺
  return request({
    url: '/goods/goods/' + id,
    method: 'get',
  })
}
